#ifndef ARENA_H_
#define ARENA_H_
#include <exception>
#include "Point.h"
#include "DoubleFiredPoint.h"
#include "OverlapBoat.h"
#include "TooNearBoat.h"
#include "Color.h"

#include "OutOfBound.h"


class Arena {
	public:
		Arena(int, int);
		Arena(const Arena&);
		virtual ~Arena();
	
		void setPoint(const Point<int>& x) throw(OutOfBound, OverlapBoat, TooNearBoat);
		
		void setFiredPoint(const Point<int>&);
		void setWaterPoint(const Point<int>&);
		void setDestroyedPoint(const Point<int>&);
		
		void fireToPoint(const Point<int>&) throw(DoubleFiredPoint, OutOfBound);

		void reset();

		void updateNearestConfiguration();

		unsigned int getXMax();
		unsigned int getYMax();
		
		Color getNormalColor(const Point<int>&);
		Color getHideColor(const Point<int>&);
		
		bool isDestroyed(const Point<int>&);
		bool isFired(const Point<int>&);
		bool isShadow(const Point<int>&);
		bool isWater(const Point<int>&);
		
		void print();
		char get(int, int);
	private:
		char** screen;
		bool** firedPoints;
		bool** nearestBoat;
		unsigned int xMax;
		unsigned int yMax;
		static const char blankCh = '_';
		static const char waterCh = '+';
		static const char boatCh = 'b';
		static const char firedCh = 'f';
		static const char destroyedCh = 'd';
};

#endif
